__author__ = 'xiaosu'

from flask_wtf import Form
from wtforms import StringField,PasswordField,TextAreaField,BooleanField,SelectField
from wtforms.validators import DataRequired

class HostForm(Form):
    ipaddress = StringField('ipaddress', validators=[DataRequired()])
    username = StringField('username', validators=[DataRequired()])
    password= PasswordField('password', validators=[DataRequired()])
    serverport=StringField('serverport',validators=[DataRequired()])
    rootpassword=PasswordField('rootpassword')
    enabled = BooleanField('enabled',default= True)
    audit = BooleanField('audit',default= True)
    comment = TextAreaField('comment')
    add_token = StringField('add_token',validators=[DataRequired()])

class ClusterForm(Form):
    clustername = StringField('clustername',validators=[DataRequired()])
    runuser = StringField('runuser', validators=[DataRequired()])
    enabled = BooleanField('enabled',default= True)
    audit = BooleanField('audit',default= True)
    comment = TextAreaField('comment')

class RunCommandForm(Form):
    command = StringField('command',validators=[DataRequired()])
    checked_hostid = StringField('checked_hostid',validators=[DataRequired()])
    runuser = StringField('runuser',validators=[DataRequired()])
    timeout = StringField('timeout',validators=[DataRequired()],default="60")
    command_token = StringField('command_token',validators=[DataRequired()])

class EditMultiHostForm(Form):
    host_list= StringField('host_list',validators=[DataRequired()])
    action = StringField('action',validators=[DataRequired()])

class RegisterForm(Form):
    loginname = StringField('loginname', validators=[DataRequired()])
    password = PasswordField('password', validators=[DataRequired()])
    realname = StringField('realname', validators=[DataRequired()])
    phonenumber = StringField('phonenumber', validators=[DataRequired()])
    email = StringField('email', validators=[DataRequired()])
    comment = TextAreaField('comment')
    is_admin = BooleanField('admin privileges',default=False)
    is_locked = BooleanField('account is locked',default=True)
    permit_clusters = StringField('permitted clusters')

class LoginForm(Form):
    loginname = StringField('loginname', validators=[DataRequired()])
    password = PasswordField('password', validators=[DataRequired()])
    remember_me = BooleanField('remember_me', default = False)

class CommandTypeForm(Form):
    typename = StringField('typename',validators=[DataRequired()])
    description = StringField('description')

class CommandForm(Form):
    command = StringField('command',validators=[DataRequired()])
    description = StringField('description')